from vtk import vtkLSDynaReader, vtkGeometryFilter


def read_lsdyna(file_path):
    reader = vtkLSDynaReader()
    reader.SetFileName(file_path)
    reader.Update()

    # 创建几何过滤器将unstructured grid转换为polyData
    geometry_filter = vtkGeometryFilter()
    geometry_filter.SetInputConnection(reader.GetOutputPort())
    geometry_filter.Update()

    # 获取转换后的polyData
    poly_data = geometry_filter.GetOutput()
